<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>vue实例生命周期</title>
    <!--Vue把整个生命周期划分为创建、挂载、更新、销毁等阶段。-->
    <script src="../js/lib/vue.min.js"></script>
</head>
<body>
<div id="app" ref="app">
    {{name}}
</div>
<script>
    // 创建vm实例
    let vm = new Vue({
        //2、挂载元素
        el:"#app",
        //3、实例vm的数据
        data:{
            name:"fesine"
        },
        // 创建前
        beforeCreate(){
            console.log('即将创建');
            console.log(this.$data);
            console.log(this.$el);
        },
        created(){
            console.log('创建完毕');
            console.log(this.$data);
            console.log(this.$el);
        },
        beforeMount(){
            console.log('挂载前');
            console.log(this.$data);
            console.log(this.$el);
        },
        mounted(){
            console.log('挂载完毕');
            console.log(this.$data);
            console.log(this.$el);
        },
        beforeUpdate(){
            console.log('==即将更新==');
            let name = this.$refs.app.innerHTML;
            console.log(name);
        },
        updated(){
            console.log('==更新完毕==');
            let name = this.$refs.app.innerHTML;
            console.log(name);
        },
        beforeDestroy(){
            console.log('==销毁前==');
        },
        destroyed(){
            console.log('==销毁后==');
        }
    });
</script>
</body>
</html>